#include <REGX52.H>
#include "delay.h"
#include "key.h"

/**
  * @brief  获取独立按键键码
  * @param  无
  * @retval 按下按键的键码，范围：0~4，无按键按下时返回值为0
  */
unsigned char KEY_Getvalue()
{
	unsigned char keyNumber = 0;
	
	if(KEY1==0){
        Delay(20);
        while(KEY1==0); // 等待松手
        Delay(20);
        keyNumber = KEYNUM1;
    }
	if(KEY2==0){Delay(20);while(KEY2==0);Delay(20);keyNumber = KEYNUM2;}
	//if(P3_2==0){Delay(20);while(P3_2==0);Delay(20);KeyNumber=3;}
	//if(P3_3==0){Delay(20);while(P3_3==0);Delay(20);KeyNumber=4;}
	
	return keyNumber;
}
